﻿using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Threading.Tasks;
using Blog.Entity.Domain;

namespace Blog.Core.Entities
{
    public interface IEntitiesDomainService<TEntity, TPrimaryKey> where TEntity : Entity<TPrimaryKey>
    {
        Task<TPrimaryKey> CreateAndGetIdAsync(TEntity entity);
        Task<TEntity> FirstOrDefultAsync(Expression<Func<TEntity, bool>> query);
        Task<TEntity> FirstOrDefultAsync(TPrimaryKey id);
        Task<List<TEntity>> GetAllListAsync();
        Task Remove(Expression<Func<TEntity, bool>> expression);
        Task Remove(TEntity entity);
        Task<TEntity> UpdateAsync(TEntity entity);
        Task<TEntity> UpdateAsync(TPrimaryKey key, Func<TEntity, Task> func);
    }
}